package com.cms.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;

@Entity
@Table(name="CMS_Channel")
@org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate=true)
public class Channel implements Serializable{
	
	private int id;
	
	private String name;
		
	private String description;
	
	private Set<ChannelArticleMapper> channelArticles = new HashSet<ChannelArticleMapper>();
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(length=32)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(length=255)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@OneToMany(cascade =CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "channel")
	@BatchSize(size=50)
	public Set<ChannelArticleMapper> getChannelArticles() {
		return channelArticles;
	}
	public void setChannelArticles(Set<ChannelArticleMapper> channelArticles) {
		this.channelArticles = channelArticles;
	}
	
}
